<%@ Language=VBScript %>
<%'------Begginging of FreeASPUploader Functions--------'%>
<% 

option explicit 
Response.Expires = -1
Server.ScriptTimeout = 600
' All communication must be in UTF-8, including the response back from the request
Session.CodePage  = 65001
%>
<!-- #include file="freeaspupload.asp" -->
<%

  Dim uploadsDirVar
  'uploadsDirVar = "d:\webdata\AFND\www\diseases\uploader"
  uploadsDirVar = Server.MapPath(".") & "\pops\"

function SaveVars
    Dim Upload
    Set Upload = New FreeASPUpload
	    Upload.Save(uploadsDirVar)
	
	SaveVars = ""
	Dim counter
	counter = Upload.Form("counter")
	SaveVars = SaveVars & "<input type='hidden' name='counter' id='counter' value='" & counter & "' />"
	
	'//DEMOGRAPHIC VARIABLES		
	Dim dis_id
	dis_id = Upload.Form("dis_id")
	Dim mesh_id
	mesh_id = Upload.Form("mesh_id")
	Dim dis_name
	dis_name = Upload.Form("dis_name")
	Dim dis_polyreg
	dis_polyreg = "KIR"
	Dim dis_city
	dis_city = Upload.Form("dis_city")
	Dim dis_region
	dis_region = Upload.Form("dis_region")
	Dim dis_country
	dis_country = Upload.Form("dis_country")
	Dim dis_cont
	dis_cont = Upload.Form("dis_cont")
	Dim pop_lat1_deg
	pop_lat1_deg = Upload.Form("pop_lat1_deg")
	Dim pop_lat1_min
	pop_lat1_min = Upload.Form("pop_lat1_min")
	Dim pop_lat1_card
	pop_lat1_card = Upload.Form("pop_lat1_card")
	Dim pop_long1_deg
	pop_long1_deg = Upload.Form("pop_long1_deg")
	Dim pop_long1_min
	pop_long1_min = Upload.Form("pop_long1_min")
	Dim pop_long1_card
	pop_long1_card = Upload.Form("pop_long1_card")
	Dim dis_eth
	dis_eth = Upload.Form("dis_eth")
	Dim dis_sample_size_ctrls
	dis_sample_size_ctrls = Upload.Form("dis_sample_size_ctrls")
	Dim dis_sample_size_spec_ctrls
	dis_sample_size_spec_ctrls = Upload.Form("dis_sample_size_spec_ctrls")
	Dim	dis_sample_size_patients
	dis_sample_size_patients = Upload.Form("dis_sample_size_patients")
	Dim dis_method
	dis_method = Upload.Form("dis_method")
	Dim pop_source_ctrls
	pop_source_ctrls = Upload.Form("pop_source_ctrls")
	Dim dis_extra_notes
	dis_extra_notes = Upload.Form("dis_extra_notes")
	Dim dis_corr_auth
	dis_corr_auth = Upload.Form("dis_corr_auth")
	Dim dis_email
	dis_email = Upload.Form("dis_email")
	Dim dis_authors
	dis_authors = Upload.Form("dis_authors")
	Dim dis_year
	dis_year = Upload.Form("dis_year")
	Dim afnd_id
	afnd_id = Upload.Form("afnd_id")
	Dim afnd_name
	afnd_name = Upload.Form("afnd_name")
	Dim dis_pub
	dis_pub = Upload.Form("dis_pub")
	Dim dis_pmid
	dis_pmid = Upload.Form("dis_pmid")
	If dis_pmid = "" Then
		dis_pmid = "0"
	End If
	Dim dis_status
	dis_status = "P"
	
    SaveVars = SaveVars & "<input type='hidden' name='dis_id' id='dis_id' value='" & dis_id & "' />"
    SaveVars = SaveVars & "<input type='hidden' name='mesh_id' id='mesh_id' value='" & mesh_id & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_name' id='dis_name' value='" & dis_name & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_polyreg' id='dis_polyreg' value='" & dis_polyreg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_city' id='dis_city' value='" & dis_city & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_region' id='dis_region' value='" & dis_region & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_country' id='dis_country' value='" & dis_country & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_cont' id='dis_cont' value='" & dis_cont & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_deg' id='pop_lat1_deg' value='" & pop_lat1_deg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_min' id='pop_lat1_min' value='" & pop_lat1_min & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_card' id='pop_lat1_card' value='" & pop_lat1_card & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_deg' id='pop_long1_deg' value='" & pop_long1_deg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_min' id='pop_long1_min' value='" & pop_long1_min & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_card' id='pop_long1_card' value='" & pop_long1_card & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_eth' id='dis_eth' value='" & dis_eth & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_ctrls' id='dis_sample_size_ctrls' value='" & dis_sample_size_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_spec_ctrls' id='dis_sample_size_spec_ctrls' value='" & dis_sample_size_spec_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_patients' id='dis_sample_size_patients' value='" & dis_sample_size_patients & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_method' id='dis_method' value='" & dis_method & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_source_ctrls' id='pop_source_ctrls' value='" & pop_source_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_corr_auth' id='dis_corr_auth' value='" & dis_corr_auth & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_email' id='dis_email' value='" & dis_email & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_authors' id='dis_authors' value='" & dis_authors & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_year' id='dis_year' value='" & dis_year & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='afnd_id' id='afnd_id' value='" & afnd_id & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='afnd_name' id='afnd_name' value='" & afnd_name & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_pub' id='dis_pub' value='" & dis_pub & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_pmid' id='dis_pmid' value='" & dis_pmid & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_extra_notes' id='dis_extra_notes' value='" & dis_extra_notes & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_status' id='dis_status' value='" & dis_status & "' />"

	'//FREQUENCY VARIABLES
  Dim haplogroup_array
redim haplogroup_array(counter) 
  Dim g2DL1_array
redim g2DL1_array(counter)
  Dim g2DL2_array
redim g2DL2_array(counter)
  Dim g2DL3_array
redim g2DL3_array(counter)
  Dim g2DL4_array
redim g2DL4_array(counter)
  Dim g2DL5_array
redim g2DL5_array(counter)
  Dim g2DP1_array
redim g2DP1_array(counter)
  Dim g2DS1_array
redim g2DS1_array(counter)
  Dim g2DS2_array
redim g2DS2_array(counter)
  Dim g2DS3_array
redim g2DS3_array(counter)
  Dim g2DS4_array
redim g2DS4_array(counter)
  Dim g2DS5_array
redim g2DS5_array(counter)
  Dim g3DL1_array
redim g3DL1_array(counter)
  Dim g3DL2_array
redim g3DL2_array(counter)
  Dim g3DL3_array
redim g3DL3_array(counter)
  Dim g3DP1_array
redim g3DP1_array(counter)
  Dim g3DS1_array
redim g3DS1_array(counter)
  Dim gA3_array
redim gA3_array(counter)
  Dim gA11_array
redim gA11_array(counter)
  Dim gBw4_array
redim gBw4_array(counter)
  Dim gBw480i_array
redim gBw480i_array(counter)
  Dim gC1_array
redim gC1_array(counter)
  Dim gC2_array
redim gC2_array(counter)
  Dim gfc_array
redim gfc_array(counter)
  Dim gfsc_array
redim gfsc_array(counter)
  Dim gfp_array
redim gfp_array(counter)
  Dim odds_array
redim odds_array(counter)
  Dim pvalue_array
redim pvalue_array(counter)
  Dim stat_array
redim stat_array(counter)
  Dim corr_array
redim corr_array(counter)



Dim i
For i = 1 to counter
	haplogroup_array(i) = Upload.Form("haplogroup" & i) 
	g2DL1_array(i) = Upload.Form("g2DL1_" & i)
	g2DL2_array(i) = Upload.Form("g2DL2_" & i)
	g2DL3_array(i) = Upload.Form("g2DL3_" & i)
	g2DL4_array(i) = Upload.Form("g2DL4_" & i)
	g2DL5_array(i) = Upload.Form("g2DL5_" & i)
	g2DP1_array(i) = Upload.Form("g2DP1_" & i)
	g2DS1_array(i) = Upload.Form("g2DS1_" & i)
	g2DS2_array(i) = Upload.Form("g2DS2_" & i)
	g2DS3_array(i) = Upload.Form("g2DS3_" & i)
	g2DS4_array(i) = Upload.Form("g2DS4_" & i)
	g2DS5_array(i) = Upload.Form("g2DS5_" & i)
	g3DL1_array(i) = Upload.Form("g3DL1_" & i)
	g3DL2_array(i) = Upload.Form("g3DL2_" & i)
	g3DL3_array(i) = Upload.Form("g3DL3_" & i)
	g3DP1_array(i) = Upload.Form("g3DP1_" & i)
	g3DS1_array(i) = Upload.Form("g3DS1_" & i)
	gA3_array(i) = Upload.Form("gA3_" & i)
	gA11_array(i) = Upload.Form("gA11_" & i)
	gBw4_array(i) = Upload.Form("gBw4_" & i)
	gBw480i_array(i) = Upload.Form("gBw480i_" & i)
	gC1_array(i) = Upload.Form("gC1_" & i)
	gC2_array(i) = Upload.Form("gC2_" & i)
	gfc_array(i) = Upload.Form("gfc" & i)
	gfsc_array(i) = Upload.Form("gfsc" & i)
	gfp_array(i) = Upload.Form("gfp" & i)
	odds_array(i) = Upload.Form("odds" & i)
	pvalue_array(i) = Upload.Form("pvalue" & i)
	stat_array(i) = Upload.Form("stat" & i)
	If stat_array(i) = "other" Then
		stat_array(i) = Upload.Form("new_stat" & i)
	End If
	stat_array(i) = Replace(stat_array(i),"'","")
	corr_array(i) = Upload.Form("corr" & i)
	If corr_array(i) = "other" Then
		corr_array(i) = Upload.Form("new_corr" & i)
	End If
	corr_array(i) = Replace(corr_array(i),"'","")
	
	SaveVars = SaveVars & "<input type='hidden' name='haplogroup" & i & "' id='haplogroup" & i & "' value='" & haplogroup_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DL1_" & i & "' id='g2DL1_" & i & "' value='" & g2DL1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DL2_" & i & "' id='g2DL2_" & i & "' value='" & g2DL2_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DL3_" & i & "' id='g2DL3_" & i & "' value='" & g2DL3_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DL4_" & i & "' id='g2DL4_" & i & "' value='" & g2DL4_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DL5_" & i & "' id='g2DL5_" & i & "' value='" & g2DL5_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DP1_" & i & "' id='g2DP1_" & i & "' value='" & g2DP1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DS1_" & i & "' id='g2DS1_" & i & "' value='" & g2DS1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DS2_" & i & "' id='g2DS2_" & i & "' value='" & g2DS2_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DS3_" & i & "' id='g2DS3_" & i & "' value='" & g2DS3_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DS4_" & i & "' id='g2DS4_" & i & "' value='" & g2DS4_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g2DS5_" & i & "' id='g2DS5_" & i & "' value='" & g2DS5_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g3DL1_" & i & "' id='g3DL1_" & i & "' value='" & g3DL1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g3DL2_" & i & "' id='g3DL2_" & i & "' value='" & g3DL2_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g3DL3_" & i & "' id='g3DL3_" & i & "' value='" & g3DL3_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g3DP1_" & i & "' id='g3DP1_" & i & "' value='" & g3DP1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='g3DS1_" & i & "' id='g3DS1_" & i & "' value='" & g3DS1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gA3_" & i & "' id='gA3_" & i & "' value='" & gA3_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gA11_" & i & "' id='gA11_" & i & "' value='" & gA11_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gBw4_" & i & "' id='gBw4_" & i & "' value='" & gBw4_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gBw480i_" & i & "' id='gBw480i_" & i & "' value='" & gBw480i_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gC1_" & i & "' id='gC1_" & i & "' value='" & gC1_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gC2_" & i & "' id='gC2_" & i & "' value='" & gC2_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gfc" & i & "' id='gfc" & i & "' value='" & gfc_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gfsc" & i & "' id='gfsc" & i & "' value='" & gfsc_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='gfp" & i & "' id='gfp" & i & "' value='" & gfp_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='odds" & i & "' id='odds" & i & "' value='" & odds_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pvalue" & i & "' id='pvalue" & i & "' value='" & pvalue_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='stat" & i & "' id='stat" & i & "' value='" & stat_array(i) & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='corr" & i & "' id='corr" & i & "' value='" & corr_array(i) & "' />"
Next
	
	Dim pnt_assoc
	pnt_assoc = Upload.Form("pnt_assoc")
	pnt_assoc = Replace(pnt_assoc,"'","$")
	
	SaveVars = SaveVars & "<input type='hidden' name='pnt_assoc' id='pnt_assoc' value='" & pnt_assoc & "' />"
	
	
	Set Upload = nothing
	
end function

%>
<%'------End of FreeASPUploader Functions--------'%>

<%'------Beginning of WebPage--------'%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
'#-------------------------------------------------------------------------------#
'#  Description:       KIR-Add a disease association study.                      #
'#                     Code:      dis2001a.asp                                   #
'#  Authors:           Louise Yukari Cicalise Takeshita							 #
'#  Created:           19 Jun 2012                                               #
'#  Ended:             19 Jun 2012                                               #
'#  Last update:       19 Jun 2012                                               #
'#  Version:           1.0.0 - 19-Jun-2012                                       #
'#  Bugs:                                                                        #
'#-------------------------------------------------------------------------------#
%>

<!-- PAGE DESCRIPTION -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="Description" content="Allele Frequencies Website" />
<meta name="Keywords" content="HLA, KIR, frequencies, allele, disease, association" />
<link rel="shortcut icon" href="../images/favicon.ico" />
<title>The Allele Frequency Net Database [Add Disease Association Study] </title>

<!-- CSS STYLE SHEETS -->
<link rel="stylesheet" type="text/css" href="../styles/format.css" />

<!-- ROUTINES -->
<script type="text/javascript" src="../routines/dis2001b.js"> </script>
<script type="text/javascript" src="../routines/logreg.js"> </script>

    <style type="text/css">
.upload {
   border-top: 1px solid #96d1f8;
   background: #65a9d7;
   background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7));
   background: -webkit-linear-gradient(top, #3e779d, #65a9d7);
   background: -moz-linear-gradient(top, #3e779d, #65a9d7);
   background: -ms-linear-gradient(top, #3e779d, #65a9d7);
   background: -o-linear-gradient(top, #3e779d, #65a9d7);
   padding: 2px 4px;
   -webkit-border-radius: 8px;
   -moz-border-radius: 8px;
   border-radius: 8px;
   -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
   -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
   box-shadow: rgba(0,0,0,1) 0 1px 0;
   text-shadow: rgba(0,0,0,.4) 0 1px 0;
   color: white;
   font-size: 10px;
   font-family: Georgia, serif;
   text-decoration: none;
   vertical-align: middle;
   }
.upload:hover {
   border-top-color: #28597a;
   background: #28597a;
   color: #ccc;
   }
.upload:active {
   border-top-color: #1b435e;
   background: #1b435e;
   }
   </style>

</head>

<body>



<%'-------------------------------------- M A I N    F R A M E W O R K ------------------------------------%>

<div style="width:950px; margin:0 auto; padding:5px 0px 5px 0px;">

<%'-------------------------------------- B O R D ER    F R A M E W O R K ---------------------------------%>
<div style="border:1px solid #0066FF;">    

<%
'#-----------------------------#
'#       H E A D E R           #
'#-----------------------------#
%>

<div id="divGenHeader">
		<table class="table10">
           <tr>
				<td><a href="default.asp"><img src="../images/banner.gif" alt="Allele Frequencies in World Populations" /></a></td>
		  </tr>
		</table>
</div>		

<%
'#-----------------------------#
'#   PROGRAM NAME              #
'#-----------------------------#
%>
<div id="divGenProg">
	<h2>KIR and diseases &raquo; Add New Disease Association Study</h2>
</div>

<%
'#-----------------------------#
'#   INSTRUCTIONS              #
'#-----------------------------#
%>
<div id="divGenInstructions">
	<h6>Instructions: Submit Raw Data</h6><br />
	<p>Now you can submit your KIR raw genotyping data.</p>
    <p>If you want to proceed, please upload your file below.</p>
    <p>If you have not downloaded KIR raw data template at the first page, click on the "Download" link below.</p>
    <p><b>KIR_Raw_Data.xls: <a href="pops/downloads/KIR_Raw_Data.xls"><u>Download</u></a></b></p>
    <p>Follow the instructions inside the template to fill out the template.</p>
</div>

<%
'#-----------------------------#
'#   NAVIGATION OPTIONS        #
'#-----------------------------#
%>
<div id="divGenNavig">	
<h2 style="line-height:25px"><span style="color:#999">Demographic Data &raquo; Frequency Data &raquo; </span>Raw Data &raquo; <span style="color:#999">Confirmation</span></h2>
</div>


<br><br>
	<div id="divGenDetail">
    	<table class="table11">
<tr>
<td>
	<table class="table04">
    
    <form name="frmSend" method="POST" enctype="multipart/form-data" accept-charset="utf-8">
    <% 'action="upload_ins.asp"
     'onSubmit="return onSubmitForm();"
	 'onclick="return onSubmitForm(); Validate('frmSend'); return fctUpload();"
	  %>
      
	<%
    response.write SaveVars()
	%>
    
<!-- Instructions -->
<tr><td>&nbsp;&nbsp;&nbsp;</td><td><h3>Upload KIR Raw Data:</h3></td></tr>
<tr><td></td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td style="border-top:2px solid #36F; border-bottom:2px solid #36F; padding:10px 10px 10px 10px"><input name="attach1" id="attach1" type="file" size=35>
<input style="margin-top:4" class="upload" name="upload" type="button" value="Upload" onclick="return fctUpload();"></td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td><div style="font-size:7px">"Powered by <A HREF="http://www.freeaspupload.net/" style="color:black">Free ASP Upload</A></div></td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td><p style="text-indent:0"><i>If you do not wish to upload raw data to AFND, click on "Next" to skip this step.</i></p></td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td><input type="button" name="next" value="Next" onclick="return fctNext();" /></td></tr>
    </form>
    </table>		
	</td>
	</tr>
</table>

</div>
<br><br>
<%'#---------------------------------------------------- END FORM --------------------------------------------------%>
</div>
<%'--------------------------------------#            END BORDER FRAMEWORK       #----------------------------------%>

<%'------------------------------------------#           FOOTER             #--------------------------------------%>
<div id="divGenFooter" align="center">
<label style="background-color:#b8cce4; border:solid 1px #006699; color:#006699; width:200; font:normal 11px Arial;">
 &copy;2012 Allele Frequencies Website.     </label>   <br /><br />
<b>Allele frequency net:</b> a database and online repository for immune gene frequencies in worldwide populations. <br />
Gonzalez-Galarza FF, Christmas S, Middleton D and Jones AR
<i>Nucleic Acid Research 2011, 39, D913-D919.</i><br />
Liverpool, U.K. <a href="mailto:support@allelefrequencies.net"><br /><br />support@allelefrequencies.net</a>
<br /><br />
<a href="http://validator.w3.org/check?uri=referer" target="_blank"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</div>
<%'------------------------------------------#            END FOOTER       #--------------------------------------%>
</div>
<%'--------------------------------------#            END MAIN FRAMEWORK       #----------------------------------%>
</body>
</html>	
